
package com.nineclock.sign.mapper;

import com.nineclock.sign.dto.SignInfoDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SignCountMapper {
    //获取当前用户当天签到次数
    @Select("SELECT COUNT(*) FROM sign_info WHERE TO_DAYS(create_date) = TO_DAYS(NOW()) AND company_user_id=#{companyUserId} AND company_id=#{companyId}")
    int queryDaySign(@Param("companyUserId") Long companyUserId, @Param("companyId") Long companyId);

    //获取当前用户指定每天签到次数
    @Select("SELECT COUNT(*) FROM sign_info WHERE create_date = #{createDate}  AND company_user_id=#{companyUserId} AND company_id=#{companyId}")
    int queryDaySign2(@Param("createDate") String createDate, @Param("companyUserId") Long companyUserId, @Param("companyId") Long companyId);

    //获取当月签到记录
    @Select("SELECT * FROM sign_info WHERE create_month=#{dateStr} AND company_user_id=#{companyUserId} AND company_id=#{companyId}")
    List<SignInfoDTO> queryMonthSign(@Param("dateStr") String dateStr, @Param("companyUserId") Long companyUserId, @Param("companyId") Long companyId);

    @Select("SELECT url FROM sign_picture WHERE sign_id=#{id}")
    List<String> querypicture(Long id);

}



